//引入VueRouter
import VueRouter from "vue-router"
import Vue from "vue"
Vue.use(VueRouter)
//创建router实例对象，去管理一组一组的路由规则
const router = new VueRouter({
  routes: [
    {
      path: "/",
      redirect: "/login"
    },
    {
      path: "/login",
      component: () => import("@/pages/user/UserLogin.vue"),
    },
    {
      path: "/index",
      component: () => import("@/pages/layout/LayOut.vue"),
      children: [
        {
          path: "page",
          component: () => import("@/pages/page/pageList.vue")
        },
        {
          path: "about",
          component: () => import("@/pages/about/AboutUs.vue")
        },
        {
          path: "modifyUser",
          component: () => import("@/pages/user/ModifyPerson.vue")
        },
        {
          path: "collegeSuggest",
          component: () => import("@/pages/suggest/CollegeSuggest.vue")
        },
        {
          path: "news",
          component: () => import("@/pages/news/NewsConsult.vue")
        },
        {
          path: "applySelect",
          component: () => import("@/pages/applySelect/ApplySelect.vue")
        },
        {
          path: "selectCollege/college",
          component: () => import("@/pages/selectCollege/college/SelevtCollege.vue")
        },
        {
          path: "selectCollege/batchLine",
          component: () => import("@/pages/selectCollege/batchLine/BatchLine.vue")
        },
        {
          path: "selectCollege/major",
          component: () => import("@/pages/selectCollege/major/SelectMajor.vue")
        },
        
      ]
    }
  ]
})
//多次点击报错
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

//暴露router
export default router
